package com.qidian.mes.md.controller;

import com.qidian.mes.md.service.MaterialBOMService;
import com.qidian.mes.pojo.MaterialBOM;
import com.qidian.mes.util.pojo.QdResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author: CoolPro
 * @Description:
 * @Time: 2024-04-08 15:23
 **/
@RestController
@RequestMapping("/bom")
@CrossOrigin
public class BOMController {
    @Autowired
    private MaterialBOMService materialBOMService;
    @GetMapping("/query/{orderId}")
    public QdResult findByOrderId(@PathVariable Integer orderId){
        return materialBOMService.findByOrderId(orderId);
    }

    @PostMapping("/add/{orderId}")
    public QdResult add(@RequestBody MaterialBOM data, @PathVariable Integer orderId){
        return materialBOMService.addMaterialBOM(data,orderId);
    }
    @PutMapping("/update/{productId}")
    public QdResult update(@RequestBody MaterialBOM data, @PathVariable Integer productId){
        return materialBOMService.updateMaterialBOM(data,productId);
    }
    @DeleteMapping("/delete")
    public QdResult delete(@RequestBody String data){
        return materialBOMService.deleteMaterialBOM(data);
    }
}
